package stx.com.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import stx.com.entity.TDiary;
import stx.com.service.DiaryService;

@Controller
public class AddDiaryController {
	
	@Resource
	private DiaryService diaryService;

	@RequestMapping("add.do")
	public String addDiary(TDiary diary,HttpServletRequest request){
		//System.out.println(diary.getAccounts());
		if(diary.getTitle()!=null&&diaryService.addDiary(diary)){
			List<TDiary> diarys=diaryService.lookDiary(diary);			
			request.setAttribute("diarys1",diarys );
			return "main";
		}
		return "false";
	}
}
